#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class Person {
public:
    char name[64];
    int age;
};
int main() {
    ifstream ifs;
    ifs.open("test2.txt", ios::out | ios::binary);
    if (!ifs.is_open()) {
        cout << "文件打开失败" << endl;
    }
    Person p;
    ifs.read((char*)&p, sizeof(Person));
    cout << p.name << " " << p.age << endl;
    ifs.close();
    return 0;
}